package demo;

import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/20-07-20-19:13
 * @Description：demo     求符合严格递增的最大子序列长度
 */
public class Max_Series {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int[] length = new int[n];
        Integer[] lengthBreak = new Integer[n];

        for(int i = 0; i < n; i++){
            array[i] = sc.nextInt();
            length[i] = 1;
            lengthBreak[i] = 1;
        }
        //计算步长
        if (n > 2){
            for(int i = n-2; i >= 0; i--){
                //不更改某一个值的情况下，
                if(array[i] <= array[i+1]){
                    length[i] = length[i+1] + 1;
                    lengthBreak[i] = lengthBreak[i+1] + 1;
                }
                //array[n-2]>array[n-1]  当前最大子序列为2
                if(i == n-2 && array[i] > array[i+1]){
                    lengthBreak[i]++;
                }
                //需要改某一个中间值
                if(i < n-2){
                    if(array[i] <= array[i+2]){
                        lengthBreak[i] = Math.max(lengthBreak[i+2]+2,length[i]);
                    }
                }
            }
            System.out.println(Arrays.asList(lengthBreak));
            System.out.println(Collections.max(Arrays.asList(lengthBreak)));
        }else{ //数组长度小于2时特殊处理
            System.out.println(n);
        }
    }
}
